package com.ikas.ai.utils;

import lombok.SneakyThrows;

import java.security.SecureRandom;
import java.util.Random;
import java.util.UUID;

/**
 * 随机数生成类
 *
 * @author HXH
 */
public class GuidUtil {
    public static String getId() {
        String guid = UUID.randomUUID().toString();
        guid = guid.replaceAll("-", "");
        return guid;
    }

    @SneakyThrows
    public static String getCheckCode4() {
        StringBuffer checkCode = new StringBuffer();
        Random random = SecureRandom.getInstanceStrong();
        for (int i = 0; i < 4; i++) {
            checkCode.append(random.nextInt(10));
        }
        return checkCode.toString();
    }
}
